package com.embedsky.administrator.mycardemulation.executor;

import java.util.concurrent.ScheduledFuture;

public interface ScheduledExecutor {
    /**
     * post delay task
     *
     * @param r     runnable
     * @param delay delay
     */
    void postDelay(Runnable r, long delay);

    /**
     * post interval task
     *
     * @param r        runnable
     * @param delay    delay
     * @param interval interval
     */
    void postInterval(Runnable r, long delay, long interval);

    /**
     * post interval range task
     *
     * @param r        runnable
     * @param delay    delay
     * @param interval interval
     * @param range    range
     */
    void postIntervalRange(Runnable r, int delay, long interval, int range);


    /**
     * post interval range task
     *
     * @param r         runnable
     * @param onTimeout onTimeout
     * @param delay     delay
     * @param interval  interval
     * @param range     range
     */
    void postIntervalRange(Runnable r, Runnable onTimeout, int delay, long interval, int range);

    /**
     * cancel schedule task by future
     *
     * @param future future to cancel
     */
    void cancel(ScheduledFuture future);

    /**
     * cancel schedule task by runnable
     *
     * @param runnable runnable to cancel
     */
    void cancel(Runnable runnable);

    /**
     * cancel all schedule taks
     */
    void cancelAll();
}
